
package app
{
	import app.controller.StartupCmd;
	import app.view.mediators.StageMediator;
	
	import flash.display.Stage;
	
	import mx.core.Application;
	
	import org.puremvc.as3.multicore.patterns.facade.Facade;
	
	

    public class AppFacade extends Facade
    {

        public function AppFacade( key:String ) {
            super(key);
        }

        public static function getInstance( key:String ):AppFacade {
            if (instanceMap[ key ] == null ) instanceMap[ key ] = new AppFacade( key );
            return instanceMap[ key ];
        }
        
        public function start( app:Application ):void{
        	registerCommand( AppConstants.START_UP, StartupCmd );
        	sendNotification( AppConstants.START_UP, app );
        	removeCommand( AppConstants.START_UP );
        }
        
        public function injectStage( stage:Stage ):void{
        	registerMediator( new StageMediator( stage ) );
        }
       
    }
}